<template>
	<view class="applyDetails">
		<view style="margin-top: 20px;text-align: center;">
			<image :src="takeCodeImg" mode="aspectFill" style="width: 200px;height: 200px;"></image>
		</view>
		<view class="join_code">
			提货码：{{takeCode}}
		</view>
	</view>
</template>

<script>
	import serve from '../static/request.js';
	import storage from '../static/appkey.js';
	import common from '../static/jump.js';
	import uniQrcode from '../static/wxqrcode.js';
	export default {
		data() {
			return {
				orderId: 0,
				takeCode : 0,
				takeCodeImg: '',
			}
		},
		methods: {
			getInfo() {
				var self = this;
				serve.request({
					url: '/member/order/get-take-code',
					data: {
						appkey: uni.getStorageSync('appkey'),
						'access-token': uni.getStorageSync('access-token'),
						id: self.orderId
					}
				}).then(res => {
					if(res.code != 200) {
						uni.showToast({
							title:res.message,
							icon: 'none',
							success() {
								common.jump('return_one');
							}
						});
					}
					self.takeCode = res.data.takeCode;
					self.takeCodeImg = uniQrcode.createQrCodeImg(self.takeCode, {
					    size: parseInt(200)
					});
				});
			},
		},
		onLoad(options) {
			this.orderId = options.orderId;
			this.getInfo();
		},
		onPullDownRefresh() {
			console.log('refresh');
			this.getInfo();
		}
	}
</script>

<style scoped lang="scss">
	.applyDetails {
		width: 100%;
		
		.join_code{
			  margin-top: 40upx;
			  position:relative;
			  text-align:center;
			  margin:40upx auto;
			  height:40upx;
			  font-size: 36upx;
			  color:#ff9800;
			  &::before,&::after{
			    content:"";
			    position:absolute;
			    top:50%;
			    border:solid 1px #fbdfb6;
			    width:16%;
			  }
			  &::before{
			    left:0;
			  }
			  &::after{
			    right:0;
			  }
		}
	}
</style>
